
// TODO: Implement this->

//using System;
//#if PSM
//using Sce.PlayStation.Core.Graphics;
//#elif DIRECTX
//using SharpDX.Direct3D11;
//#elif OPENGL
//#if MONOMAC
//using MonoMac.OpenGL;
//#elif WINDOWS || LINUX
//using OpenTK.Graphics.OpenGL;
//#elif GLES
//using OpenTK.Graphics.ES20;
//using RenderbufferTarget = OpenTK.Graphics.ES20.All;
//using RenderbufferStorage = OpenTK.Graphics.ES20.All;
//#endif
//#endif

#ifndef RenderTarget2D_h
#define RenderTarget2D_h

#include <Defines.h>
#include <CSharpPropertyMethods.h>

// Riccsson includes.
#include <System/Object.h>
#include <System/Type.h>
#include <System/String.h>
#include <System/Generic/EventHandler.h>
#include <System/EventArgs.h>

// XNA includes.
#include "Texture2D.h"
#include "IRenderTarget.h"
#include "States/DepthFormat.h"
#include "RenderTargetUsage.h"
#include "SurfaceFormat.h"

namespace Riccsson
{
	namespace Xna
	{
		namespace Framework
		{
			namespace Graphics
			{
				class RenderTarget2D
					: public Texture2D
					, public IRenderTarget
				{
			#if GLES
					const RenderbufferTarget GLRenderbuffer = RenderbufferTarget.Renderbuffer;
					const RenderbufferStorage GLDepthComponent16 = RenderbufferStorage.DepthComponent16;
					const RenderbufferStorage GLDepthComponent24 = RenderbufferStorage.DepthComponent24Oes;
					const RenderbufferStorage GLDepth24Stencil8 = RenderbufferStorage.Depth24Stencil8Oes;
			#elif OPENGL
					const RenderbufferTarget GLRenderbuffer = RenderbufferTarget.RenderbufferExt;
					const RenderbufferStorage GLDepthComponent16 = RenderbufferStorage.DepthComponent16;
					const RenderbufferStorage GLDepthComponent24 = RenderbufferStorage.DepthComponent24;
					const RenderbufferStorage GLDepth24Stencil8 = RenderbufferStorage.Depth24Stencil8;
			#endif

			#if DIRECTX
					private: RenderTargetView _renderTargetView;
					private: DepthStencilView _depthStencilView;
			#elif OPENGL
					public: /*internal*/ uint glDepthStencilBuffer;
			#elif PSM
					public: /*internal*/ FrameBuffer _frameBuffer;
			#endif

					public: DepthFormat DepthStencilFormat;// { get; private: set; }
		
					public: int MultiSampleCount;// { get; private: set; }
		
					public: RenderTargetUsage renderTargetUsage;// { get; private: set; }
		
					public: PROP3_GET(bool, IsContentLost)
					{
						return false;
					}
					private: PROP3_SET(bool, IsContentLost){throw;}
		
					public: event<Void, Riccsson::System::Generic::EventHandler<Riccsson::System::EventArgs>> ContentLost;
		
					public: RenderTarget2D (GC_PTR<GraphicsDevice> graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
						: Texture2D(graphicsDevice, width, height, mipMap, preferredFormat, true)
					{
						throw;
					}
					//
					//public: RenderTarget2D(GC_PTR<GraphicsDevice> graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat)
					//	: Texture2D(graphicsDevice, width, height, mipMap, preferredFormat, preferredDepthFormat, 0, RenderTargetUsage::DiscardContents) 
					//{}
					//
					//public: RenderTarget2D(GC_PTR<GraphicsDevice> graphicsDevice, int width, int height)
					//	: Texture2D(graphicsDevice, width, height, false, SurfaceFormat::Color, DepthFormat::None, 0, RenderTargetUsage::DiscardContents) 
					//{}

					protected: override void Dispose(bool disposing)
					{
						throw;
					}

			#if DIRECTX
					//RenderTargetView IRenderTarget.GetRenderTargetView(int arraySlice)
					//{
					//	return _renderTargetView;
					//}
					//
					//DepthStencilView IRenderTarget.GetDepthStencilView()
					//{
					//	return _depthStencilView;
					//}
			#endif
				};
			}
		}
	}
}

#endif